import http from '../util/http';

const addGroup = data => http.postData(data, `/api/group/create?groupCollectionId=${data.groupCollectionId}`);
const addGroupCollection = data => http.postData(data, '/admin/api/group_collection/create');
const uploadImg = data => http.postData(data, '/api/group/uploadImage');
const getGroup = data => http.getData(data, '/api/group');
const getGroupCollection = data => http.getData(data, '/admin/api/group_collection');
const getPublicAccountsWithDefault = data => http.getData(data, '/api/publicAccountsWithDefault');
const getGroupDetail = data => http.getData(data, `/api/group/${data.groupId}`);
const getGroupCollectionDetail = data => http.getData(data, `/admin/api/group_collection/${data.groupCollectionId}`);
const editGroupDetail = data => http.postData(data, `/api/group/${data.groupId}/edit`);
const editGroupCollectionDetail = data => http.postData(data, `/admin/api/group_collection/${data.groupCollectionId}/edit`);
const getGroupImgById = data => http.getData(data, `/api/group/images/${data.imageId}`);
const getGroupCollectionByAppId = appId => http.getData({}, `/admin/api/group_collection/appId/${appId}`);
const changeGroupActive = data => http.postData(data, `/api/group/${data.groupId}/status`);
const changeGroupCollectionActive = data => http.postData(data, `/admin/api/group_collection/${data.groupCollectionId}/status`);
const getQunKuMember = data => http.getData(data, '/api/group_collection_open_id/list');

export default {
  addGroup,
  addGroupCollection,
  uploadImg,
  getGroup,
  getGroupCollection,
  getPublicAccountsWithDefault,
  getGroupDetail,
  getGroupCollectionDetail,
  editGroupDetail,
  editGroupCollectionDetail,
  getGroupImgById,
  getGroupCollectionByAppId,
  changeGroupActive,
  changeGroupCollectionActive,
  getQunKuMember,
};
